package com.xiaopengwei.springboot.rabbitmq.rabbit.hello;import org.springframework.amqp.core.AmqpTemplate;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Component;import java.util.Date;/** * <p> * 生产者 * </p> * * @author XiaoPengwei.com * @since 2019-04-20 */@Componentpublic class HelloSender {    @Autowired    private AmqpTemplate rabbitTemplate;    public void send() {        String context = "hello " + new Date();        System.out.println("Sender : " + context);        this.rabbitTemplate.convertAndSend("hello", context);    }}